<%@page import="systems.ConfigSystem"%>
<%@page import="helpers.StringHelper"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.TreeMap"%>
<%@page import="java.util.Map"%>
<%@page import="entities.MetaSeo"%>
<%@page import="entities.SiteConfig"%>
<%
SiteConfig siteConfig = ConfigSystem.getConfigs();
String name = (String) request.getAttribute("name");
SiteConfig configs = (SiteConfig) request.getAttribute("config");
MetaSeo metaseo = (MetaSeo) request.getAttribute("metaseo");

//Set content for Seo
Map<String, String> replates = new TreeMap<String, String>();
replates.put("__SERVER_NAME__", UrlHelper.getDomainServer(request));
replates.put("__SERVER_URL__", UrlHelper.getServerUrl(request));
replates.put("__NAME__", name);


String title = StringHelper.replateContent(metaseo.getTitle(), replates);
String description = StringHelper.replateContent(metaseo.getDescription(), replates);
String keywords = StringHelper.replateContent(metaseo.getKeywords(), replates);
String url = StringHelper.replateContent(metaseo.getOgurl(), replates);
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/templates/default_lang/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="keywords" value="<%=keywords %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=url %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

	<script type="text/javascript" src="/templates/<%=siteConfig.getTemplate() %>/js/search.js"></script>
		<div class="mainContent clearafter">
			<div class="leftMainContent">
			
				<!-- Content Tab -->
				<div class="content">
					<div class="content_in">
						<h1 class="page_title">Search Result for <%=name %>: </h1>
						<div class="breadcrumbs">
							<p>
								<a href="/">Home</a> » Search
							</p>
						</div>
						<div class="page_content">
							
							<!-- search -->
							<form action="/search" id="cse-main-search-box">
								<input type="hidden" name="cx" value="<%=configs.getCxGoogleSearch() %>" /> 
								<input type="hidden" name="cof" value="FORID:10" /> 
								<input type="hidden" name="ie" value="UTF-8" /> 
								<input id="cse-main-search-text" type="text" name="q" autocomplete="on" class="input_search" size="55"/> 
								<input type="submit" name="sa" value="Search" />
							</form>
							<script type="text/javascript" src="//www.google.com/jsapi"></script>	
							<script type="text/javascript">
								google.load('search', '1');
								google.setOnLoadCallback(function() {
									google.search.CustomSearchControl.attachAutoCompletionWithOptions(
											'013315504628135767172:d6shbtxu-uo+qptype:1', document
													.getElementById('cse-main-search-text'),
											'cse-main-search-box', {
												'styleOptions' : {
													'widthOffset' : 150
												}
											});
								});
							</script>
							<div id="cse-search-results"></div>
							<script type="text/javascript">
							  var googleSearchIframeName = "cse-search-results";
							  var googleSearchFormName = "cse-search-box";
							  var googleSearchDomain = "www.google.com";
							  var googleSearchPath = "/cse";
							</script>
							<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>
		
							<!-- end search -->		
							
						</div>
					</div>
				</div>
				<!-- End Content tab -->
			</div>
			<jsp:include page="/templates/default_lang/elements/right.jsp" />
		</div>
<jsp:include page="/templates/default_lang/layouts/footer.jsp" />